package com.edu.exam.enums.examination;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 事件级别枚举
 */
@Getter
@AllArgsConstructor
public enum EventLevel {
    CRITICAL("CRITICAL", "严重"),
    HIGH("HIGH", "高"),
    MEDIUM("MEDIUM", "中"),
    LOW("LOW", "低"),
    INFO("INFO", "信息"),
    DEBUG("DEBUG", "调试"),
    TRACE("TRACE", "跟踪");

    private final String code;
    private final String description;

    public static EventLevel fromCode(String code) {
        for (EventLevel level : values()) {
            if (level.getCode().equals(code)) {
                return level;
            }
        }
        return INFO; // 默认返回信息
    }
}